package com.zzyl.framework.config;

import com.aliyun.iot20180120.Client;
import com.aliyun.teaopenapi.models.Config;
import com.zzyl.framework.config.properties.AliIoTConfigProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class IotClientConfig {
    @Bean
    public Client client(AliIoTConfigProperties aliIoTConfigProperties) throws Exception {
        Config config = new Config();
        //从环境变量中读取阿里云访问凭证
        config.accessKeyId = "LTAI5tBhZWLFduyMwftYgpAq";
        config.accessKeySecret = "kg2n17BONj8lhZK1j8pPbFy6QeounN";
        //可用区id 默认为cn-shanghai
        config.regionId = aliIoTConfigProperties.getRegionId();
        return new Client(config);

    }
}
